package com.tarena.jdbc;

import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;

public class EmpTest {
	public static void main(String[] args) throws Exception{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@192.168.10.22:1521:tarena",
				"openlab",
				"open123");
		System.out.println(conn);
		Statement statement = conn.createStatement();
		String sql = "select * from dept_snail";
		ResultSet rs = statement.executeQuery(sql);
		while(rs.next()){
			System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+ rs.getString(3));
		}
		rs.close();
		statement.close();
		conn.close();
	}
}
